﻿using HaiFengShop.Tools;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace HaiFengShop.ORM
{
    public class SugarDbContext
    {
        public SugarDbContext(string ConnectionString)
        {
            Db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = ConnectionString,
                DbType = DbType.MySql,
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
                //,MoreSettings =new ConnMoreSettings { IsWithNoLockQuery=true}
            });

            //Db.Aop.OnLogExecuting = (sql, pars) =>
            //{
            //    string s = sql;
            //    Hl.Core.Logger.LoggerFactory.Instance.Logger_Info(s);
            //};
        }

        public SqlSugarClient Db;

    }
}
